<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

var createTime ='<c:out value="${docIssue.createTime}"/>';
var sendTime ='<c:out value="${docIssue.sendTime}"/>';
var timeType ='<c:out value="${timeType}"/>';

var limitObj=new Object();//用于保存word正文控制大小信息对象  limitObj.num限制大小  limitObj.str限制大小对应提示文字
limitObj.num=10485760;//默认10M
limitObj.str="10M";//默认10M

$(function(){
	//因为tab页签里面使用的是iframe，所以加载完成后需要调整iframe高度。
	//ps:如果调用此方法，jsp页面中<!DOCTYPE>标签必须写在最顶端，不然在垃圾ie浏览器中获取不到body高度
	$(window.self.frameElement).height($("body").outerHeight(true));
	if("sendTime"==timeType){		
		$("#createTime").textbox("setValue", dataFormatStr(new Date((new Date(sendTime))- 1000*60*60*24),"yyyy-MM-dd"));
	}else{
		$("#createTime").textbox("setValue", dataFormatStr(new Date((new Date(createTime))- 1000*60*60*24),"yyyy-MM-dd"));
		//$("#createTime").textbox("setValue", dataFormatStr(new Date(createTime),"yyyy-MM-dd"));
	}
	//$("#createTime").val(dataFormatStr(new Date(createTime),"yyyy-MM-dd"));
	$.ajax({
		type: "POST",
		url: "<c:url value='/receive/querySynOfficial' />",
		data:"docId="+$("#docId").val(),
		dataType: "json",
		success: function(msg){
			if(msg.state=="200"){
		    }else{
		    	$("#OfficialTd").html("没有正文");
		    }
		}
	});
});

//下载附件
function fileUploadDownloadDocAttach(control,attachId,suffixName,attachName){
	var newFlag="";
	if("newFile"==$(control).parent("li").attr("class")){
		newFlag="1";
	}else{
		newFlag="0";
	}
	window.location.href =_synergyContext+"/basic/synAttach/downLoadFile?attachId=" + attachId + "&attachName="+encodeURIComponent(encodeURIComponent(attachName))+"&suffixName="+suffixName+"&newFlag="+newFlag;
}

//查看正文公文
function showDocDocument(){
	var docId = $("#docId").val();
	//下载公文到app下
	$.ajax({//ajax保存表单基本信息
	   type: "POST",
	   url: "<c:url value='/receive/querySynOfficial' />",
	   data:"docId="+docId,
	   dataType: "json",
	   async:false,
	   success: function(msg){
	     if(msg.state=="200"){
	    	 var vHeight = window.screen.height -73 ;
//    		 var wordUrl =_synergyContext+"/basic/office/editOffice?docId=" + docId + "&fileReadOnly=true&notkHeigth="+vHeight;
	    	 var wordUrl =_synergyContext+"/basic/office/editOfficeNoDocId" + "?docId=" +docId + "&formId=-1&docType=done&fileReadOnly=true&notkHeigth="+vHeight+"&limitNum="+limitObj.num+"&limitStr="+limitObj.str;
//    		 var winFeatures = "height="+vHeight+"px,width="+(window.screen.width-20)+"px,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no";
//    		 window.open(wordUrl,'_blank',winFeatures);
	    	 ntkoBrowser.openWindow(wordUrl);
	    	 
	     }else{
	    	 $.messager.alert("提示","该公文没有正文");
	    	 return;
	     }
	   }
	});
}

function downloadOfficeFile(){
	window.location.href=_synergyContext+'/basic/office/downLoadFile?docId='+$("#docId").val()+"&officeName="+encodeURIComponent(encodeURIComponent($("#docName").textbox("getValue")));
}
